package com.sxhuayuan.parking.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Index;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.sxhuayuan.parking.config.Platform;

/**
 * 记录车主服务车牌状态，每个微信只可绑定1个车牌，1个车牌只可被1个微信绑定，绑定的车牌不分场景均可使用，
 * 官方接口可用openid查到车牌，也能用车牌查到openid
 * 
 * 支付宝的member可能为空
 */
@Entity
@Table(name = "hypk_partnerpay", indexes = { @Index(columnList = "carPlate") })
public class Partnerpay extends BaseEntity {

	private static final long serialVersionUID = -5457166967209890345L;

	private String carPlate;

	private Platform platform;

	private Member member;

	/** 车牌状态 */
	private State state;

	/** 车牌可用状态 */
	public enum State {
		// 可用
		NORMAL,
		// 不可用
		BLOCKED
	}

	@Column(nullable = false, length = 32)
	public String getCarPlate() {
		return carPlate;
	}

	public void setCarPlate(String carPlate) {
		this.carPlate = carPlate;
	}

	@Column(nullable = false)
	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	@Column(nullable = false)
	public Platform getPlatform() {
		return platform;
	}

	public void setPlatform(Platform platform) {
		this.platform = platform;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	public Member getMember() {
		return member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

}
